home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1179 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. From: Roman Lechtchinsky <wolfro@cs.tu-berlin.de>
  2. Message-ID: <3178D6BB.7167@cs.tu-berlin.de>
  3. X-Original-Date: Sat, 20 Apr 1996 14:21:15 +0200
  4. Path: in2.uu.net!bounce-back
  5. Date: 20 Apr 96 16:16:11 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: Member templates
  9. Organization: Technical University of Berlin
  10. References: <31763F3F.805@cs.tu-berlin.de> <xsoivewlve3.fsf@avs.cs.rpi.edu>
  11. X-Mailer: Mozilla 2.0 (Win95; I)
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMXkN2OEDnX0m9pzZAQHy/gF/VoSenJZSKyw8qJYAfKGEDJ4wvQIMmolU
  14.     fg+XHap8/IAfE+dP8YuT0/rnJnIxD7vx
  15.     =zfNa
  16.  
  17. David Vandevoorde wrote:
  18. > >>>>> "RL" == Roman Lechtchinsky <wolfro@cs.tu-berlin.de> writes:
  19. > [...]
  20. > RL> class Base
  21. > RL> {
  22. > RL>  virtual void f(int);
  23. > RL> };
  24. > RL> class Derived : Base
  25. > RL> {
  26. > RL> template<class T> void f(T);
  27. > RL> };
  28. > RL> Is this legal? If so, will the template function f(int) override
  29. > RL> Base::f(int)? If so, when will it be instantiated? And, last but not
  30. > RL> least, which section of the DWP handles this case? Thanks in advance.
  31. > I believe this is legal and the instantiated member function is not
  32. > virtual (i.e., no overriding), but my reason extrapolates the WPs
  33. > somewhat. I base this on the fact that the `signature' of a template
  34. > function includes the actual template arguments ([temp.over.link]
  35. > 14.10.4/3 in the April CD), and that when [class.virtual] 10.3/2
  36. > requires `same name', `name' really means template-id and not just
  37. > template-name ([temp.names] 14.1).
  38.  
  39. IMO, this means that f cannot be overridden in Derived:
  40.  
  41. class Derived : Base
  42. {
  43.  template<class T> void f(T);
  44.  void f(int);
  45. };
  46.  
  47. would be a specialization which means that f doesn't override as it is still 
  48. a template ( [temp.over.spec] 14.10.5 ). Is this interpretation correct?
  49.  
  50. Bye
  51.  
  52. Roman
  53. ---
  54. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  55. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  56. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  57. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  58. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  59.